home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 117
/
FreelogNo117-OctobreNovembre2013.iso
/
Programmation
/
jedit
/
jedit5.1.0install.exe
/
{app}
/
macros
/
Clipboard
/
Copy_Lines_Containing.bsh
next >
Wrap
Text File
|
2013-07-28
|
1KB
|
33 lines
/*
* Copy_Lines_Containing.bsh - Copies lines from current buffer that
* contain a user-supplied string to the clipboard.
*
* Copyright (C) 2004 Ollie Rutherfurd <oliver@jedit.org>
*
* $Id: Copy_Lines_Containing.bsh 21353 2012-03-14 09:46:51Z jojaba_67 $
*/
//Localization
final static String CopyLinesContainingLabel = jEdit.getProperty("macro.rs.CopyLinesContaining.CopyLinesContaining.label", "Copy lines containing:");
final static String LinesCopiedMessage = jEdit.getProperty("macro.rs.CopyLinesContaining.LinesCopied.message", "line(s) copied");
copyLinesContaining(){
String text = Macros.input(view, CopyLinesContainingLabel);
if(text == null || "".equals(text))
return;
int count = 0;
StringBuffer buff = new StringBuffer();
for(int i = 0; i < buffer.getLineCount(); i++){
String line = buffer.getLineText(i);
if(line.indexOf(text) > -1){
buff.append(line).append('\n');
count++;
}
}
Registers.setRegister('$',buff.toString());
HistoryModel.getModel("clipboard").addItem(buff.toString());
view.getStatus().setMessageAndClear(count + " " + LinesCopiedMessage);
}
copyLinesContaining();